<template>
  <div>
    <el-table
      :data="list"
      style="width: 800px;"
    >
      <el-table-column
        label="头像"
        width="140"
        align="center"
      >
        <template slot-scope="scope">
          <el-image
            style="width: 40px; height: 40px; border-radius: 20px; display: block; margin: 0 auto;"
            :src="scope.row.avatar+'?style=imageMogr2/thumbnail/400x)'"
            fit="contain"
            v-if="scope.row.avatar != '' && scope.row.avatar"
          />
          <el-image
            style="width: 40px; height: 40px; border-radius: 20px; display: block; margin: 0 auto;"
            src="https://gamumu.hilumo.com/prod-api/files/down/1966718622402392064.png?style=imageMogr2/thumbnail/400x)"
            fit="contain"
            v-else
          />

        </template>
      </el-table-column>
      <el-table-column
        prop="nickName"
        label="昵称"
        align="center"
      />
      <el-table-column
        prop="phonenumber"
        label="手机号码"
        align="center"
      >
        <template slot-scope="scope">
          <span v-if="scope.row.phonenumber && scope.row.phonenumber != ''">{{ scope.row.phonenumber }}</span>
          <span v-else>--</span>
        </template>
      </el-table-column>
      <!-- <el-table-column
        label="性别"
        align="center"
      >
        <template slot-scope="scope">
          <span v-if="scope.row.sex == 0">男</span>
          <span v-if="scope.row.sex == 1">女</span>
          <span v-if="scope.row.sex == 2">--</span>
        </template>
      </el-table-column> -->
      <el-table-column
        label="操作"
        align="center"
      >
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-s-order" @click="showOrder(scope.row)">查看订单</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 订单 -->
    <OrderList :data="order" />
  </div>
</template>

<script>
  import OrderList from './OrderList.vue';
  export default {
    components: {
      OrderList
    },
    props: {
      list: {
        type: Array,
        default() {
          return []
        }
      }
    },
    data() {
      return {
        order: {
          show: false,
          list: []
        }
      }
    },
    methods: {
      showOrder(item) {
        this.order.list = item.photoPayList.length ? item.photoPayList : []
        this.order.show = true
      }
    }
  }
</script>

<style lang="sass" scoped>

</style>